home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / IPFlakeWay / Squelch Module / source / NatRTSP.h < prev    next >
Text File  |  2000-06-23  |  3KB  |  73 lines

  1. // =================================================================================
  2. //    NatRTSP.h                     ©1999 Sustainable Softworks. All rights reserved.
  3. // =================================================================================
  4. //    Network Address Translation for RTSP SETUP commands.
  5. //    Opens a return path through the firewall (NAT function) for client
  6. //    streams specified in RTSP SETUP commands.
  7. //    This module translates the data portion of IP datagrams
  8. //    (technically a layering violation).
  9. //
  10. //    Since we must operate in the STREAMS context, this module is written
  11. //    in traditional C (not C++).
  12.  
  13. #ifndef _H_NatRTSP
  14. #define _H_NatRTSP
  15. #pragma once
  16.  
  17. #include "NatTable.h"
  18. #define nilp(type)        ((type*)0)
  19.  
  20. // ---------------------------------------------------------------------------
  21. //        • Convert2ApparentRTSP
  22. // ---------------------------------------------------------------------------
  23. // Convert outgoing datagrams to appear as if they originate from
  24. // the apparent endpoint.  Return false if not a valid datagram or
  25. // no translation entry could be found or created.
  26. //
  27. // Handle RTSP control channel
  28. // We assume there can only be one SETUP command per segment!
  29. Boolean
  30. Convert2ApparentRTSP(translationEntry_t table[],
  31.                     UInt8* datagram,
  32.                     mblk_t* mp,
  33.                     translationEntry_t* inLookupEntry,
  34.                     ip_header_t* ipHeader,
  35.                     tcp_header_t* tcpHeader);
  36.  
  37. // ---------------------------------------------------------------------------
  38. //        • Convert2ActualRTSP
  39. // ---------------------------------------------------------------------------
  40. // Convert incomming datagram addressed to an apparent endpoint to
  41. // be forwarded to the corresponding actual endpoint.
  42. //
  43. // Handle RTSP control channel
  44. // We assume there can only be one PORT command per segment!
  45. Boolean
  46. Convert2ActualRTSP(translationEntry_t table[],
  47.                     UInt8* datagram,
  48.                     mblk_t* mp,
  49.                     translationEntry_t* inLookupEntry,
  50.                     ip_header_t* ipHeader,
  51.                     tcp_header_t* tcpHeader);
  52.  
  53. // ---------------------------------------------------------------------------
  54. //        • DecodeRTSPClientPort
  55. // ---------------------------------------------------------------------------
  56. //    Convert RTSP client_port="aaaa-bbbb" command to a protocol port range
  57. //    Return length of port range data, or Zero if command error detected
  58. UInt8
  59. DecodeRTSPClientPort(char* inStr, UInt16* outPortA, UInt16* outPortB);
  60.  
  61. // ---------------------------------------------------------------------------
  62. //        • EncodeRTSPClientPort
  63. // ---------------------------------------------------------------------------
  64. //    Convert protocol port range to RTSP client_port="aaaa-bbbb" command
  65. //    Output as null terminated string.
  66. UInt8
  67. EncodeRTSPClientPort(UInt16 inPortA, UInt16 inPortB, char* outStr);
  68.  
  69.  
  70. #define kRTSPControlPort 554
  71. #define kRTSPAlternatePort 7070
  72.  
  73. #endif